package com.zky.gulimall.search.controller;

import com.zky.common.to.es.SkuEsModel;
import com.zky.common.utils.R;
import com.zky.gulimall.search.Service.ProductSaveService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @Description es
 * @Author 张开源
 * @Date 2022/10/17 20:30
 * @Version 1.0
 **/
@RestController
@RequestMapping("/search/save")
public class EsSaveController {
    @Autowired
    private ProductSaveService productSaveService;
    /**
     * 商品上架
     */
    @PostMapping("/product")
    public R productStatusUp(@RequestBody List<SkuEsModel> skuEsModels) {
        try {
            Boolean aBoolean = productSaveService.productStatusUp(skuEsModels);
            return R.ok().put("data",aBoolean);
        } catch (Exception e) {
            e.printStackTrace();
            return R.error(e.getMessage());
        }
    }
}
